//
//  ServiceDetailsViewController.m
//  yunyan
//
//  Created by chirui on 2018/5/4.
//  Copyright © 2018年 haichuang. All rights reserved.
//

#import "ServiceDetailsViewController.h"
#import <WebKit/WebKit.h>


@interface ServiceDetailsViewController ()

@property (nonatomic, strong) UIWebView *webView;
@end

@implementation ServiceDetailsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   self.view.backgroundColor =[UIColor whiteColor];
    
     [self customNaviItemTitle:self.titleStr isLeft:NO];
    
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,WIDTH, HEIGHT-SH_TopHeight)];
//    _webView.scalesPageToFit = YES;
    
    [self.view addSubview:self.webView];
    
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithIcon:@"currency_back_default" target:self action:@selector(back)];
    
    [self getGoodsDetailsRequest];
}

-(void)back{
    
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)creatWebWith:(NSString *)str {
    
    
    
    NSURL* url =[NSURL URLWithString:str];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    
    [_webView loadRequest:request];
}

-(void)getGoodsDetailsRequest{
    
    if ([self.titleStr isEqualToString:@"读报"]) {
        [self creatWebWith:@"http://paper.gywb.cn"];
    }
    if ([self.titleStr isEqualToString:@"快递查询"]) {
        [self creatWebWith:@"http://www.kuaidi100.com"];
    }
    if ([self.titleStr isEqualToString:@"烘焙达人"]) {
        [self creatWebWith:@"http://www.xiachufang.com"];
    }
    if ([self.titleStr isEqualToString:@"航班查询"]) {
        [self creatWebWith:@"https://flight.qunar.com"];
    }
    if ([self.titleStr isEqualToString:@"模拟驾考"]) {
        [self creatWebWith:@"http://www.jiakaobaodian.com/mnks"];
    }
    if ([self.titleStr isEqualToString:@"吃客汇"]) {
        [self creatWebWith:@"http://www.gywb.cn/cate/node_2063.htm"];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
